package com.quasar.hpatient.presenter;

import com.quasar.hpatient.model.httpmodel.AnotherResult;
import com.quasar.hpatient.model.medicalmodel.DailyRecordData;
import com.quasar.hpatient.model.requestmodel.RequestModel;
import com.quasar.hpatient.onInterface.AnotherResultListener;
import com.quasar.hpatient.onInterface.OnHistoryDailyListenter;

/**
 * author : 许建宏
 * Date: 2017/11/25 0025
 * View:历史日常检查
 */

public class HistoryDailyDataPresenter {
    private RequestModel requestModel;
    private OnHistoryDailyListenter onHistoryDailyListenter;

    public HistoryDailyDataPresenter(OnHistoryDailyListenter onHistoryDailyListenter){
        this.requestModel = new RequestModel();
        this.onHistoryDailyListenter = onHistoryDailyListenter;
    }

    //获取历史日常日期
    public void GetPatientDailyRecords(String startTime,String endTime){

        requestModel.GetPatientDailyRecordsData(startTime, endTime, new AnotherResultListener<AnotherResult<DailyRecordData>>() {
            @Override
            public void onSuccess(AnotherResult<DailyRecordData> data) {
                onHistoryDailyListenter.onViewDataSuccess(data);
            }

            @Override
            public void onError(String msg) {
                onHistoryDailyListenter.onViewError(msg);
            }

            @Override
            public void onRefreshUI() {
                onHistoryDailyListenter.onViewRefreshUI();
            }
        });
    }

}
